let i = 0;

const timedCount = function timedCount() {
  i += 1;
  postMessage(i);
  setTimeout(timedCount, 500);
};

onmessage = function (ev) {
  if (ev.data === 'start') {
    timedCount();
  }
};

importScripts('./foo.js', './bar.js');

foo();
bar();
